<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    button.active{
      background-color: red;
    }
    .content{
      width: 200px;
      height: 200px;
      border: 1px solid #333;
    }
  </style>
</head>
<body>
  <div id="app">
    <button @click="tabChange(0)" :class="{active: num === 0}">标题1</button>
    <button  @click="tabChange(1)" :class="{active: num === 1}">标题2</button>
    <button  @click="tabChange(2)" :class="{active: num === 2}">标题3</button>

    
    <div v-show="num === 0" class="content">内容1</div>
    <div v-show="num === 1" class="content">内容2</div>
    <div v-show="num === 2" class="content">内容3</div>
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      el: '#app',
      data: {
        num: 0,
        tabs: [
          {
            title:'标题1',
            content: '内容1'
          },
          {
            title:'标题2',
            content: '内容2'
          },
          {
            title:'标题3',
            content: '内容3'
          }
        ]
      },
      methods: {
        tabChange(index){
          this.num = index;
        }
      }
    })
  </script>
</body>
</html>